// Townscript for town 30: Trashpit

begintownscript;

variables;

int choice;

body;

beginstate INIT_STATE;

		set_level(6,25); // Golem and alien beast levels down
		set_level(7,25);
		set_level(9,30);
		
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;

if (get_flag(30,2) == 0) {
		message_dialog("You enter a filthy looking (and smelling) pit. This must be Thralni's trash pits. It looks as though the walls have collapsed, which isn't really surprising, thinking of the stuff that probably passes this place.","");
		set_flag(30,2,1);
		}

break;

beginstate 10;
	move_to_new_town(29,58,40);
break;

beginstate 11;
	move_to_new_town(29,54,42);
break;

beginstate 12;
if (get_flag(30,0) == 1)
		end();
	reset_dialog();
	add_dialog_str(0,"You come across a set of runes. They glow calmly. Behind the runes stand a bunch of levers. It might be necessary to get to them, but you'll have to cross the runes. What do you do?",0);
	add_dialog_choice(0,"Proceed");
	add_dialog_choice(1,"Stay back");
	choice = run_dialog(0);
	
	if (choice == 1) {
			message_dialog("The moment you stand on the runes, you hear a flash and you get blinded for a moment. You look behind you, right into the eyes of two golems.","");
			
			put_boom_on_space(11,16,4,0);
			put_boom_on_space(11,14,4,0);
			run_animation_sound(54);
			pause(3);
			
			activate_hidden_group(7);
			put_boom_on_space(11,16,2,0);
			put_boom_on_space(11,14,2,0);
			run_animation_sound(10);
			set_flag(30,0,1);
			pause(3);
			end();
			}
	
	if (choice == 2)
			block_entry(1);
	
break;

beginstate 13;
if (get_flag(30,1) == 1)
		end();
	message_dialog("You stand at a slope going upwards. This may be your ticket out of this filthy place! You think you see a crack in the wall at the end of the slope.","");
	set_flag(30,1,1);
break;

beginstate 14;
if (get_flag(30,3) == 0) {
		message_dialog("You pass this part of the cave wall, and are surprised to find that somebody scribbled 2 3 1 on it. You wonder what it means.","");
		set_flag(30,3,1);
		}
break;